package cn.iocoder.yudao.module.book.dal.mysql.voice;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.book.dal.dataobject.voice.VoiceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.book.controller.admin.voice.vo.*;

/**
 * 录音 Mapper
 *
 * @author xi
 */
@Mapper
public interface VoiceMapper extends BaseMapperX<VoiceDO> {

    default PageResult<VoiceDO> selectPage(VoicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VoiceDO>()
                .eqIfPresent(VoiceDO::getVoiceId, reqVO.getVoiceId())
                .eqIfPresent(VoiceDO::getUserId, reqVO.getUserId())
                .eqIfPresent(VoiceDO::getBookId, reqVO.getBookId())
                .eqIfPresent(VoiceDO::getAudioUrl, reqVO.getAudioUrl())
                .eqIfPresent(VoiceDO::getReadingUrl, reqVO.getReadingUrl())
                .eqIfPresent(VoiceDO::getScore, reqVO.getScore())
                .betweenIfPresent(VoiceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VoiceDO::getVoiceId));
    }

}